package com.zw.admin.server.config.mqtt;

import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;

public class MqttConsumerCallBack implements MqttCallback {
    @Override
    public void connectionLost(Throwable throwable) {

    }

    @Override
    public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
        System.out.println("进入！！！！！！！！！！！！！！！！！！");
        System.out.println(String.format("接收消息主题 : %s",s));
        System.out.println(String.format("接收消息Qos : %d",mqttMessage.getQos()));
        System.out.println(String.format("接收消息内容 : %s",new String(mqttMessage.getPayload())));
        System.out.println(String.format("接收消息retained : %b",mqttMessage.isRetained()));
    }

    @Override
    public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {

    }
}
